| Total Complexity | 6 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; |
||
| 9 | |||
| 10 | @Entity() |
||
| 11 | export class Notification { |
||
| 12 | @PrimaryGeneratedColumn('uuid') |
||
| 13 | private id: string; |
||
| 14 | |||
| 15 | @Column('enum', { enum: NotificationType, nullable: false }) |
||
| 16 | private type: NotificationType; |
||
| 17 | |||
| 18 | @Column({ type: 'varchar', nullable: false }) |
||
| 19 | private resourceId: string; |
||
| 20 | |||
| 21 | @Column({ type: 'varchar', nullable: false }) |
||
| 22 | private message: string; |
||
| 23 | |||
| 24 | @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) |
||
| 25 | private createdAt: Date; |
||
| 26 | |||
| 27 | @ManyToOne(type => LeaveRequest, { nullable: true, onDelete: 'SET NULL' }) |
||
| 28 | private leaveRequest: LeaveRequest; |
||
| 29 | |||
| 30 | constructor( |
||
| 31 | type: NotificationType, |
||
| 32 | message: string, |
||
| 33 | resourceId: string, |
||
| 34 | leaveRequest: LeaveRequest |
||
| 35 | ) { |
||
| 36 | this.type = type; |
||
| 37 | this.message = message; |
||
| 38 | this.resourceId = resourceId; |
||
| 39 | this.leaveRequest = leaveRequest; |
||
| 40 | } |
||
| 41 | |||
| 42 | public getId(): string { |
||
| 43 | return this.id; |
||
| 44 | } |
||
| 45 | |||
| 46 | public getType(): string { |
||
| 47 | return this.type; |
||
| 48 | } |
||
| 49 | |||
| 50 | public getMessage(): string { |
||
| 51 | return this.message; |
||
| 52 | } |
||
| 53 | |||
| 54 | public getResourceId(): string { |
||
| 55 | return this.resourceId; |
||
| 56 | } |
||
| 57 | |||
| 58 | public getLeaveRequest(): LeaveRequest { |
||
| 59 | return this.leaveRequest; |
||
| 60 | } |
||
| 61 | |||
| 62 | public getCreatedAt(): Date { |
||
| 63 | return this.createdAt; |
||
| 64 | } |
||
| 66 |